﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Facade.SupplierModule.DataTransferObject;
using Resto.CostControl.Core.Cache;
using Resto.CostControl.Core.Enums;

namespace Resto.CostControl.Core.Query.SupplierModule.ViewObject
{
    [Serializable]
    public class MaterialPurchaseVO
    {
        #region 基本属性

        public string ID { get; set; }

        /// <summary>
        /// 合同编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 供应商Id
        /// </summary>
        public string SupplierId { get; set; }

        public string SupplierName
        {
            get
            {
                SupplierDTO supplierDTO = SupplierDTOCache.Get(SupplierId);
                if (supplierDTO != null)
                    return supplierDTO.Name;
                else
                    return string.Empty;
            }
        }


        /// <summary>
        /// 订购日期
        /// </summary>
        public DateTime OrderDate { get; set; }

        /// <summary>
        /// 价格汇总
        /// </summary>
        public decimal TotalPrice { get; set; }

        /// <summary>
        /// 采购单状态
        /// </summary>
        internal string OrderStateCode { get; set; }

        /// <summary>
        /// 采购单状态
        /// </summary>
        public MaterialPurchaseState OrderState
        {
            get
            {
                return (MaterialPurchaseState)Enum.Parse(typeof(MaterialPurchaseState), this.OrderStateCode);
            }
        }

        #endregion
    }
}
